# 设置最低版本要求
cmake_minimum_required(VERSION 3.0)

# 定义项目名称
project(ConcurrentMemoryPool)

# 添加可执行文件及其源文件
add_executable(MemoryPool
    ConcurrentMemoryPool/Benchmark.cpp
    ConcurrentMemoryPool/CentralCache.cpp
    ConcurrentMemoryPool/ThreadCache.cpp
    ConcurrentMemoryPool/PageCache.cpp
    ConcurrentMemoryPool/unitTest.cpp
    ConcurrentMemoryPool/CentralCache.h
    ConcurrentMemoryPool/Common.h
    ConcurrentMemoryPool/ConcurrentAlloc.h
    ConcurrentMemoryPool/ThreadCache.h
    ConcurrentMemoryPool/ObjectPool.h    
    ConcurrentMemoryPool/PageCache.h
    ConcurrentMemoryPool/PageMap.h
)

# 检测平台并在 Linux 上链接线程库
if(UNIX)
    find_package(Threads REQUIRED)
    target_link_libraries(MemoryPool ${CMAKE_THREAD_LIBS_INIT})
endif()
